#include "Common.h"

Common::Common()
{
	//ctor
}

Common::~Common()
{
	//dtor
}

// split(ret, “a：b”, ":");
int Common::split(char _out[][128], char* _in, const char* _spliter)
{
	int splitCount = 0; 														// 切割成的个数

	char* strTemp = strsep(&_in, _spliter);
	while(strTemp != nullptr )
	{
		if(strlen(strTemp)<= sizeof(_out[splitCount]))
		{
			memcpy(_out[splitCount],  strTemp, strlen(strTemp));
		}
		else
		{
			cout<<"error. str beyond lenth."<< endl;
		}

		splitCount++;
		strTemp = strsep(&_in, _spliter);
	}

	return splitCount;
}
